{template 'common/header'}
<style>
	.popover{width:400px;max-width:400px;}
	.label{line-height: 2}
</style>
<ul class="nav nav-tabs">
	<li><a href="{php echo url('mc/mass')}"> 微信群发</a></li>
	<li class="active"><a href="{php echo url('mc/mass/send')}"> 已发送</a></li>
</ul>

<div class="clearfix">
	<form action="?{$_SERVER['QUERY_STRING']}" method="post" id="form1">
		<div class="panel panel-default">
			<div class="panel-body table-responsive">
				<table class="table table-hover" cellspacing="0" cellpadding="0">
					<thead class="navbar-inner">
					<tr>
						<th>消息详情</th>
						<th>发送用户组</th>
						<th>发送人数</th>
						<th>状态</th>
						<th>发送时间</th>
						<th>添加时间</th>
						<th width="120"></th>
					</tr>
					</thead>
					<tbody>
						{loop $list $li}
							<tr>
								<td>
									<a href="{php echo url('material/display/list', array('type' => $li['msgtype'], 'id' => $li['attach_id']));}" target="_blank">{$types[$li['msgtype']]}</a>
								</td>
								<td>{$li['groupname']}</td>
								<td>{if $li['groupname'] == '全部用户'}NAN{else}{$li['fansnum']}{/if}</td>
								<td>
									{if !$li['status']}
										<span class="label label-success">已发送</span>
									{elseif $li['status'] == 1}
										<span class="label label-warning">未发送</span> <br>
										<span class="label label-info">计划发送时间:{php echo date('Y-m-d H:i', $li['sendtime']);}</span>
									{elseif $li['status'] == 2}
										<span class="label label-danger">发送失败</span>
									{/if}
								</td>
								<td>
									{if !$li['type']}
										{php echo date('Y-m-d H:i:s', $li['createtime']);}
									{else}
										{if !$li['status']}
											{php echo date('Y-m-d H:i:s', $li['sendtime']);}
										{elseif $li['status'] == 1}
											未发送
										{/if}
									{/if}
								</td>
								<td>{php echo date('Y-m-d H:i:s', $li['createtime']);}</td>
								<td align="right">
									{if $li['type'] == 1 && !$li['cron_id'] && $li['sendtime'] > TIMESTAMP}
									<a href="{php echo url('material/mass/cron', array('id' => $li['id']));}" class="btn btn-danger btn-sm">同步到云服务</a>
									{/if}
								</td>
							</tr>
						{/loop}
					</tbody>
				</table>
			</div>
		</div>
	</form>
</div>
<script>
	require(['bootstrap'], function(){
		$('.tip').hover(function(){
			$(this).tooltip();
		});
	});
</script>
{template 'common/footer'}